=========================================================================== BBS: The Abacus * HST/DS * Potterville MI Date: 03-01-93 (15:01) Number: 21 From: VICTOR YIU Refer#: NONE To: ALL Recvd: NO Subj: PostIt! 5.0 6/11 Conf: (35) Quick Basi --------------------------------------------------------------------------- '>>> Start of page 6. FUNCTION Analyze$ (filename$) Analyze = "N" OPEN filename$ FOR BINARY AS #5 Tmp$ = INPUT$(20, #5) FOR A = 1 TO 20 IF MID$(Tmp$, A, 1) < " " THEN Analyze = "Y": EXIT FOR IF MID$(Tmp$, A, 1) > "~" THEN HiASCII = HiASCII + 1 NEXT IF HiASCII > 12 THEN Analyze = "Y" CLOSE #5 END FUNCTION ' ======== Compress$ ŝ Victor Yiu ' This function returns the compressed equivalent of the output ' stream (PostIt! code). Originally, I had a blank for defining ' the most common character to compress (in front of each line), ' but after lots of testing, I decided to remove that -- and just ' hard code it to "a" (input string ASCII 0) -- which is the ' most common in the types of files that will be run through ' binary PostIt!. ' ' I would also like to say that this procedure DOES NOT compress ' plain ASCII or ZIP file input very well. It is best with ' binary files, especially OBJect files. Those can see savings ' of up to 20%, while ZIP or ASCII (you should NEVER run ASCII ' through binary PostIt! anyway...) don't compress much. ' The longer the file, the better your results (final out) will ' be compared to 4.0, due to the increased size of the loader. ' ' Here are some statistics for you all to munch on... ' ' Test results: +===================+=====================+ ' | PostIt! 4.0 | PostIt! 5.0 | ' +-------------------+---------------------+ ' WINA20.386 | Size: 14057 bytes | Size: 6762 | ' (9349 bytes) | Time: 4.2 secs. | Time: 2.4 secs. | ' +-------------------+---------------------+ ' Note: 5.0 compressed it 52%, & conversion is 43% faster. ' ~~~~~~~~~~~~~~~~~~~~~ ' +===================+=====================+ ' BOXLIB.OBJ | Size: 11029 bytes | Size: 9766 | ' (7268 bytes) | Time: 3.4 secs. | Time: 1.8 secs. | ' +-------------------+---------------------+ ' Note: 5.0 compressed it 11%, & conversion is 47% faster also. ' ' BOXLIB.ZIP +===================+=====================+ ' (4224 bytes) | Size: 6630 | Size: 6552 | ' | Time: 2.0 secs. | Time: 1.0 secs. | ' +-------------------+---------------------+ ' Note: 5.0 compressed it 1%, and was 50% faster. ' ' +===================+=====================+ ' QBMPASM.OBJ | Size: 1691 bytes | Size: 1707 | ' (763 bytes) | Time: 0.33 secs. | Time: 0.2 secs. | ' +-------------------+---------------------+ ' Note: Both had the same size, but conversion was 40% faster. ' ' ' Victor Yiu (2/28/93) ' FUNCTION Compress$ (A$) SHARED ComprChar$, Prefix$, Qt$ IF INSTR(A$, "aa") THEN ' compressable FOR Leng = 7 TO 2 STEP -1 ' start searching for 7 a's Look4$ = STRING$(Leng, "a") ' all the way down to 2... Found = 3 DO Found = INSTR(Found, A$, Look4$) ' found? IF Found THEN ' yes; replace it w/marker A$ = LEFT$(A$, Found - 1) + MID$(ComprChar$, Leng - 1,_ 1) + MID$(A$, Found + Leng) Found = Found + 1 ' new search position... END IF LOOP WHILE Found ' loop until no more... NEXT END IF Compress$ = A$ END FUNCTION SUB CopyrightScreen Linein 1 COLOR 15, 1 LOCATE 4, 1 PRINT " ħħħħħħħħħÜ ħħÜ" '>>> Continued on page 7. --- Blue Wave/RA v2.10 [NR] * Origin: Hard Disc Cafe / Houston Texas / (713) 589-2690 / Node -*N (1:106/30. 0) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 950 203/23 209/209 280/1 SEEN-BY: 390/1 396/1 15 397/2 2230/100 3603/20